package com.wangshouyu.mp.micro.base.response;

import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.gson.annotations.SerializedName;

import java.io.Serializable;
import java.util.Objects;

/**
 * @author 王守钰
 * @description 基本返回结果
 * @date 2020/8/19 9:07
 */
public class BaseResponse implements Serializable {

    /**
     * 错误代码
     */
    @SerializedName(value = "errcode")
    @JsonProperty(value = "errcode")
    @JSONField(name = "errcode")
    private String errCode;

    /**
     * 错误消息
     */
    @SerializedName(value = "errmsg")
    @JsonProperty(value = "errmsg")
    @JSONField(name = "errmsg")
    private String errorMsg;

    public String getErrCode() {
        return errCode;
    }

    public String getErrorMsg() {
        return errorMsg;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        BaseResponse that = (BaseResponse) o;
        return Objects.equals(errCode, that.errCode) && Objects.equals(errorMsg, that.errorMsg);
    }

    @Override
    public int hashCode() {
        return Objects.hash(errCode, errorMsg);
    }

    @Override
    public String toString() {
        return "BaseResponse{" +
                "errCode='" + errCode + '\'' +
                ", errorMsg='" + errorMsg + '\'' +
                '}';
    }
}

